package com.fly.easy.queue.common;

import org.apache.log4j.Logger;

import com.fly.easy.queue.croe.FlyClient;

public class ConsumerTask implements Runnable {
	/**
	 * 日志
	 */
	private static Logger logger = Logger.getLogger(FlyClient.class);
	private Channel channel;
	private FlyClient client;
	

	public ConsumerTask(Channel channel,FlyClient client) {
		super();
		this.channel = channel;
		this.client=client;
	}
	public void run() {
		while (true) {
			try {
				MessageEntity entity = channel.getMessageQueue().poll();
				client.queryHandle(entity.getHandle()).proccess(entity);
			} catch (Exception e) {
				logger.error("proccess error ", e);
			}
		}
	}

}
